<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>Faiss: faiss::Index Struct Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Faiss
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Friends</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespacefaiss.html">faiss</a></li><li class="navelem"><a class="el" href="structfaiss_1_1Index.html">Index</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-types">Public Types</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-attribs">Public Attributes</a> &#124;
<a href="structfaiss_1_1Index-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">faiss::Index Struct Reference<span class="mlabels"><span class="mlabel">abstract</span></span></div>  </div>
</div><!--header-->
<div class="contents">

<p><code>#include &lt;<a class="el" href="Index_8h_source.html">Index.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for faiss::Index:</div>
<div class="dyncontent">
 <div class="center">
  <img src="structfaiss_1_1Index.png" usemap="#faiss::Index_map" alt=""/>
  <map id="faiss::Index_map" name="faiss::Index_map">
<area href="classfaiss_1_1gpu_1_1GpuIndex.html" alt="faiss::gpu::GpuIndex" shape="rect" coords="176,56,342,80"/>
<area href="structfaiss_1_1Index2Layer.html" alt="faiss::Index2Layer" shape="rect" coords="176,112,342,136"/>
<area href="structfaiss_1_1IndexFlat.html" alt="faiss::IndexFlat" shape="rect" coords="176,168,342,192"/>
<area href="structfaiss_1_1IndexHNSW.html" alt="faiss::IndexHNSW" shape="rect" coords="176,224,342,248"/>
<area href="structfaiss_1_1IndexIDMap.html" alt="faiss::IndexIDMap" shape="rect" coords="176,280,342,304"/>
<area href="structfaiss_1_1IndexIVF.html" alt="faiss::IndexIVF" shape="rect" coords="176,336,342,360"/>
<area href="structfaiss_1_1IndexLSH.html" alt="faiss::IndexLSH" shape="rect" coords="176,392,342,416"/>
<area href="structfaiss_1_1IndexPQ.html" alt="faiss::IndexPQ" shape="rect" coords="176,448,342,472"/>
<area href="structfaiss_1_1IndexPreTransform.html" alt="faiss::IndexPreTransform" shape="rect" coords="176,504,342,528"/>
<area href="structfaiss_1_1IndexRefineFlat.html" alt="faiss::IndexRefineFlat" shape="rect" coords="176,560,342,584"/>
<area href="structfaiss_1_1IndexScalarQuantizer.html" alt="faiss::IndexScalarQuantizer" shape="rect" coords="176,616,342,640"/>
<area href="structfaiss_1_1IndexSplitVectors.html" alt="faiss::IndexSplitVectors" shape="rect" coords="176,672,342,696"/>
<area href="structfaiss_1_1MultiIndexQuantizer.html" alt="faiss::MultiIndexQuantizer" shape="rect" coords="176,728,342,752"/>
</map>
 </div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr class="memitem:ad3f0d3071f987baabbdd3da4500c87ea"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad3f0d3071f987baabbdd3da4500c87ea"></a>
using&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a> = long</td></tr>
<tr class="memdesc:ad3f0d3071f987baabbdd3da4500c87ea"><td class="mdescLeft">&#160;</td><td class="mdescRight">all indices are this type <br/></td></tr>
<tr class="separator:ad3f0d3071f987baabbdd3da4500c87ea"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af317cb1e2ad0bd145f716f2243b693eb"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af317cb1e2ad0bd145f716f2243b693eb"></a>
using&#160;</td><td class="memItemRight" valign="bottom"><b>component_t</b> = float</td></tr>
<tr class="separator:af317cb1e2ad0bd145f716f2243b693eb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1c60d7a12bf3ad27054963df8cccd93f"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a1c60d7a12bf3ad27054963df8cccd93f"></a>
using&#160;</td><td class="memItemRight" valign="bottom"><b>distance_t</b> = float</td></tr>
<tr class="separator:a1c60d7a12bf3ad27054963df8cccd93f"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a7b8cc435b5619d5d8382010a424bf67e"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a7b8cc435b5619d5d8382010a424bf67e"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>Index</b> (<a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a> <a class="el" href="structfaiss_1_1Index.html#a2a002388d2c081c2dbab8508dcefe73d">d</a>=0, <a class="el" href="namespacefaiss.html#afd12191c638da74760ff397cf319752c">MetricType</a> metric=METRIC_L2)</td></tr>
<tr class="separator:a7b8cc435b5619d5d8382010a424bf67e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abf601502bdbfa02b9d7bcd7b3671b71d"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1Index.html#abf601502bdbfa02b9d7bcd7b3671b71d">train</a> (<a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a> n, const float *x)</td></tr>
<tr class="separator:abf601502bdbfa02b9d7bcd7b3671b71d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1b5e9ac70adbce0897dd6c8276ad96f2"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1Index.html#a1b5e9ac70adbce0897dd6c8276ad96f2">add</a> (<a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a> n, const float *x)=0</td></tr>
<tr class="separator:a1b5e9ac70adbce0897dd6c8276ad96f2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa6931dfe054b33b02c842ff75f7a0c7f"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1Index.html#aa6931dfe054b33b02c842ff75f7a0c7f">add_with_ids</a> (<a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a> n, const float *x, const long *xids)</td></tr>
<tr class="separator:aa6931dfe054b33b02c842ff75f7a0c7f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aced51b1ebc33c47ab3ae15ea906559a7"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1Index.html#aced51b1ebc33c47ab3ae15ea906559a7">search</a> (<a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a> n, const float *x, <a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a> k, float *distances, <a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a> *labels) const =0</td></tr>
<tr class="separator:aced51b1ebc33c47ab3ae15ea906559a7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a236897832a58dbb205e2d662c1929fb1"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1Index.html#a236897832a58dbb205e2d662c1929fb1">range_search</a> (<a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a> n, const float *x, float radius, <a class="el" href="structfaiss_1_1RangeSearchResult.html">RangeSearchResult</a> *result) const </td></tr>
<tr class="separator:a236897832a58dbb205e2d662c1929fb1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8bc5d8d1cd0dd7b34b3c98a9f76b4a9c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1Index.html#a8bc5d8d1cd0dd7b34b3c98a9f76b4a9c">assign</a> (<a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a> n, const float *x, <a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a> *labels, <a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a> k=1)</td></tr>
<tr class="separator:a8bc5d8d1cd0dd7b34b3c98a9f76b4a9c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a849361f5f0ab0aba8d419c86f2594191"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a849361f5f0ab0aba8d419c86f2594191"></a>
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1Index.html#a849361f5f0ab0aba8d419c86f2594191">reset</a> ()=0</td></tr>
<tr class="memdesc:a849361f5f0ab0aba8d419c86f2594191"><td class="mdescLeft">&#160;</td><td class="mdescRight">removes all elements from the database. <br/></td></tr>
<tr class="separator:a849361f5f0ab0aba8d419c86f2594191"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af8bf7bd97aeed8ad5fc48b242379a68a"><td class="memItemLeft" align="right" valign="top">virtual long&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1Index.html#af8bf7bd97aeed8ad5fc48b242379a68a">remove_ids</a> (const <a class="el" href="structfaiss_1_1IDSelector.html">IDSelector</a> &amp;sel)</td></tr>
<tr class="separator:af8bf7bd97aeed8ad5fc48b242379a68a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aaef6f4132b1f390121ebb11058baf190"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1Index.html#aaef6f4132b1f390121ebb11058baf190">reconstruct</a> (<a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a> key, float *recons) const </td></tr>
<tr class="separator:aaef6f4132b1f390121ebb11058baf190"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1936604fffe16b0ef2a3879305950738"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1Index.html#a1936604fffe16b0ef2a3879305950738">reconstruct_n</a> (<a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a> i0, <a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a> ni, float *recons) const </td></tr>
<tr class="separator:a1936604fffe16b0ef2a3879305950738"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa5b4e63e1064f9bf9c75625d114b353f"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1Index.html#aa5b4e63e1064f9bf9c75625d114b353f">search_and_reconstruct</a> (<a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a> n, const float *x, <a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a> k, float *distances, <a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a> *labels, float *recons) const </td></tr>
<tr class="separator:aa5b4e63e1064f9bf9c75625d114b353f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aaae77608bbda70b1098897e9167a82f9"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1Index.html#aaae77608bbda70b1098897e9167a82f9">compute_residual</a> (const float *x, float *residual, <a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a> key) const </td></tr>
<tr class="separator:aaae77608bbda70b1098897e9167a82f9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a373c30e3d87d1d4e616f450d87152b1a"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1Index.html#a373c30e3d87d1d4e616f450d87152b1a">display</a> () const </td></tr>
<tr class="separator:a373c30e3d87d1d4e616f450d87152b1a"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Public Attributes</h2></td></tr>
<tr class="memitem:a2a002388d2c081c2dbab8508dcefe73d"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2a002388d2c081c2dbab8508dcefe73d"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1Index.html#a2a002388d2c081c2dbab8508dcefe73d">d</a></td></tr>
<tr class="memdesc:a2a002388d2c081c2dbab8508dcefe73d"><td class="mdescLeft">&#160;</td><td class="mdescRight">vector dimension <br/></td></tr>
<tr class="separator:a2a002388d2c081c2dbab8508dcefe73d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6970683faa021b7a6f1a0865c0d4eccd"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6970683faa021b7a6f1a0865c0d4eccd"></a>
<a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1Index.html#a6970683faa021b7a6f1a0865c0d4eccd">ntotal</a></td></tr>
<tr class="memdesc:a6970683faa021b7a6f1a0865c0d4eccd"><td class="mdescLeft">&#160;</td><td class="mdescRight">total nb of indexed vectors <br/></td></tr>
<tr class="separator:a6970683faa021b7a6f1a0865c0d4eccd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5590d847c5c2b958affd2a05e58a6f23"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a5590d847c5c2b958affd2a05e58a6f23"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1Index.html#a5590d847c5c2b958affd2a05e58a6f23">verbose</a></td></tr>
<tr class="memdesc:a5590d847c5c2b958affd2a05e58a6f23"><td class="mdescLeft">&#160;</td><td class="mdescRight">verbosity level <br/></td></tr>
<tr class="separator:a5590d847c5c2b958affd2a05e58a6f23"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6e92732617c4dbe364e7678dd8773a7f"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6e92732617c4dbe364e7678dd8773a7f"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1Index.html#a6e92732617c4dbe364e7678dd8773a7f">is_trained</a></td></tr>
<tr class="memdesc:a6e92732617c4dbe364e7678dd8773a7f"><td class="mdescLeft">&#160;</td><td class="mdescRight">set if the <a class="el" href="structfaiss_1_1Index.html">Index</a> does not require training, or if training is done already <br/></td></tr>
<tr class="separator:a6e92732617c4dbe364e7678dd8773a7f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8e18f641854b2bde83ecff0a2f9a6f4e"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8e18f641854b2bde83ecff0a2f9a6f4e"></a>
<a class="el" href="namespacefaiss.html#afd12191c638da74760ff397cf319752c">MetricType</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1Index.html#a8e18f641854b2bde83ecff0a2f9a6f4e">metric_type</a></td></tr>
<tr class="memdesc:a8e18f641854b2bde83ecff0a2f9a6f4e"><td class="mdescLeft">&#160;</td><td class="mdescRight">type of metric this index uses for search <br/></td></tr>
<tr class="separator:a8e18f641854b2bde83ecff0a2f9a6f4e"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Abstract structure for an index</p>
<p>Supports adding vertices and searching them.</p>
<p>Currently only asymmetric queries are supported: database-to-database queries are not implemented. </p>

<p>Definition at line <a class="el" href="Index_8h_source.html#l00061">61</a> of file <a class="el" href="Index_8h_source.html">Index.h</a>.</p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a1b5e9ac70adbce0897dd6c8276ad96f2"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void faiss::Index::add </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a>&#160;</td>
          <td class="paramname"><em>n</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const float *&#160;</td>
          <td class="paramname"><em>x</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Add n vectors of dimension d to the index.</p>
<p>Vectors are implicitly assigned labels ntotal .. ntotal + n - 1 This function slices the input vectors in chuncks smaller than blocksize_add and calls add_core. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">x</td><td>input matrix, size n * d </td></tr>
  </table>
  </dd>
</dl>

<p>Implemented in <a class="el" href="structfaiss_1_1IndexPreTransform.html#a03c77c582a3421952e2cba2057083059">faiss::IndexPreTransform</a>, <a class="el" href="structfaiss_1_1Index2Layer.html#a0aa69e64a2b216a01f99366e8ca4dc7b">faiss::Index2Layer</a>, <a class="el" href="structfaiss_1_1MultiIndexQuantizer.html#aa72640bcbe2e5d9029954c2fa6633453">faiss::MultiIndexQuantizer</a>, <a class="el" href="structfaiss_1_1IndexFlat1D.html#a5dc39280262484ecadda5e11162c2457">faiss::IndexFlat1D</a>, <a class="el" href="structfaiss_1_1IndexIVF.html#a821002a9d3a1a74dc8d6f6072eca4075">faiss::IndexIVF</a>, <a class="el" href="structfaiss_1_1IndexRefineFlat.html#a10d5009c838e8653fd767ca48a3e6fcc">faiss::IndexRefineFlat</a>, <a class="el" href="structfaiss_1_1IndexScalarQuantizer.html#ad49602f9ecfcaa2ec8737a449b69ccd7">faiss::IndexScalarQuantizer</a>, <a class="el" href="structfaiss_1_1IndexSplitVectors.html#af2ef88dc72b4a94f1190ecc8cb25881b">faiss::IndexSplitVectors</a>, <a class="el" href="structfaiss_1_1IndexHNSW.html#a04a761ce17d0f9040b3bc8a77bd627d9">faiss::IndexHNSW</a>, <a class="el" href="classfaiss_1_1gpu_1_1GpuIndexFlat.html#a35d31b6b5ea89629b369655fd03bd505">faiss::gpu::GpuIndexFlat</a>, <a class="el" href="classfaiss_1_1gpu_1_1GpuIndex.html#af576341f6996b0e80e26b9748db51eb7">faiss::gpu::GpuIndex</a>, <a class="el" href="structfaiss_1_1IndexLSH.html#a76de2c3212c72fd48136d84283a6e0a8">faiss::IndexLSH</a>, <a class="el" href="structfaiss_1_1IndexPQ.html#ac72c9b93f8fe7e5ec27fbe26bb38a7bf">faiss::IndexPQ</a>, <a class="el" href="structfaiss_1_1IndexIDMap.html#a16cce6c1e83d0d5f069c9b0399896450">faiss::IndexIDMap</a>, and <a class="el" href="structfaiss_1_1IndexFlat.html#a406f028c702edec72477eacc5733f59c">faiss::IndexFlat</a>.</p>

</div>
</div>
<a class="anchor" id="aa6931dfe054b33b02c842ff75f7a0c7f"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void faiss::Index::add_with_ids </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a>&#160;</td>
          <td class="paramname"><em>n</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const float *&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const long *&#160;</td>
          <td class="paramname"><em>xids</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Same as add, but stores xids instead of sequential ids.</p>
<p>The default implementation fails with an assertion, as it is not supported by all indexes.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">xids</td><td>if non-null, ids to store for the vectors (size n) </td></tr>
  </table>
  </dd>
</dl>

<p>Reimplemented in <a class="el" href="structfaiss_1_1IndexPreTransform.html#a07fef0553b2ef2907f394470f61898b2">faiss::IndexPreTransform</a>, <a class="el" href="structfaiss_1_1IndexIVFPQR.html#a4b6154a5194d574d037ba78c137a2fa5">faiss::IndexIVFPQR</a>, <a class="el" href="structfaiss_1_1IndexIVFScalarQuantizer.html#afa95c17787b7e3dbed9309b440d4d748">faiss::IndexIVFScalarQuantizer</a>, <a class="el" href="structfaiss_1_1IndexIVF.html#a14e75169bddcd0251134821416b060a1">faiss::IndexIVF</a>, <a class="el" href="structfaiss_1_1IndexIVFFlatDedup.html#ae1d5f41f4987f4e02938738436f082bf">faiss::IndexIVFFlatDedup</a>, <a class="el" href="structfaiss_1_1IndexIDMap2.html#a33ff76975891695c2fa45ed26fc8eae9">faiss::IndexIDMap2</a>, <a class="el" href="structfaiss_1_1IndexIVFPQ.html#a981c2748bfbd9b018494f119279a0342">faiss::IndexIVFPQ</a>, <a class="el" href="classfaiss_1_1gpu_1_1GpuIndex.html#a47f6969fe60d82b8e3407557ba9eec88">faiss::gpu::GpuIndex</a>, <a class="el" href="structfaiss_1_1IndexIVFFlat.html#a5f7356766632d3ce2838f285aa6b8e76">faiss::IndexIVFFlat</a>, and <a class="el" href="structfaiss_1_1IndexIDMap.html#aeace75e53648c052d05c357b744e090b">faiss::IndexIDMap</a>.</p>

<p>Definition at line <a class="el" href="Index_8cpp_source.html#l00041">41</a> of file <a class="el" href="Index_8cpp_source.html">Index.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a8bc5d8d1cd0dd7b34b3c98a9f76b4a9c"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void faiss::Index::assign </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a>&#160;</td>
          <td class="paramname"><em>n</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const float *&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a> *&#160;</td>
          <td class="paramname"><em>labels</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a>&#160;</td>
          <td class="paramname"><em>k</em> = <code>1</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>return the indexes of the k vectors closest to the query x.</p>
<p>This function is identical as search but only return labels of neighbors. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">x</td><td>input vectors to search, size n * d </td></tr>
    <tr><td class="paramname">labels</td><td>output labels of the NNs, size n*k </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="Index_8cpp_source.html#l00034">34</a> of file <a class="el" href="Index_8cpp_source.html">Index.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="aaae77608bbda70b1098897e9167a82f9"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void faiss::Index::compute_residual </td>
          <td>(</td>
          <td class="paramtype">const float *&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float *&#160;</td>
          <td class="paramname"><em>residual</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a>&#160;</td>
          <td class="paramname"><em>key</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Computes a residual vector after indexing encoding.</p>
<p>The residual vector is the difference between a vector and the reconstruction that can be decoded from its representation in the index. The residual can be used for multiple-stage indexing methods, like <a class="el" href="structfaiss_1_1IndexIVF.html">IndexIVF</a>'s methods.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">x</td><td>input vector, size d </td></tr>
    <tr><td class="paramname">residual</td><td>output residual vector, size d </td></tr>
    <tr><td class="paramname">key</td><td>encoded index, as returned by search and assign </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="Index_8cpp_source.html#l00086">86</a> of file <a class="el" href="Index_8cpp_source.html">Index.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a373c30e3d87d1d4e616f450d87152b1a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void faiss::Index::display </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Display the actual class name and some more info </p>

<p>Definition at line <a class="el" href="Index_8cpp_source.html#l00094">94</a> of file <a class="el" href="Index_8cpp_source.html">Index.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a236897832a58dbb205e2d662c1929fb1"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void faiss::Index::range_search </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a>&#160;</td>
          <td class="paramname"><em>n</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const float *&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float&#160;</td>
          <td class="paramname"><em>radius</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structfaiss_1_1RangeSearchResult.html">RangeSearchResult</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>query n vectors of dimension d to the index.</p>
<p>return all vectors with distance &lt; radius. Note that many indexes do not implement the range_search (only the k-NN search is mandatory).</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">x</td><td>input vectors to search, size n * d </td></tr>
    <tr><td class="paramname">radius</td><td>search radius </td></tr>
    <tr><td class="paramname">result</td><td>result table </td></tr>
  </table>
  </dd>
</dl>

<p>Reimplemented in <a class="el" href="structfaiss_1_1IndexPreTransform.html#a7d19f68aae0c30f1641ed9f2b2303bae">faiss::IndexPreTransform</a>, <a class="el" href="structfaiss_1_1IndexIVF.html#a5b7b4b3dc5ea40f7076a00c81cc83d66">faiss::IndexIVF</a>, <a class="el" href="structfaiss_1_1IndexIVFFlatDedup.html#acb4f1350039546f5001c5fc36ac0fb2d">faiss::IndexIVFFlatDedup</a>, <a class="el" href="structfaiss_1_1IndexIDMap.html#a7dbeaf9d44d6783d371f12405e8b7f40">faiss::IndexIDMap</a>, and <a class="el" href="structfaiss_1_1IndexFlat.html#ac56b7ed90ab65fab9c586a1e56006d12">faiss::IndexFlat</a>.</p>

<p>Definition at line <a class="el" href="Index_8cpp_source.html#l00028">28</a> of file <a class="el" href="Index_8cpp_source.html">Index.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="aaef6f4132b1f390121ebb11058baf190"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void faiss::Index::reconstruct </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a>&#160;</td>
          <td class="paramname"><em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float *&#160;</td>
          <td class="paramname"><em>recons</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Reconstruct a stored vector (or an approximation if lossy coding)</p>
<p>this function may not be defined for some indexes </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">key</td><td>id of the vector to reconstruct </td></tr>
    <tr><td class="paramname">recons</td><td>reconstucted vector (size d) </td></tr>
  </table>
  </dd>
</dl>

<p>Reimplemented in <a class="el" href="structfaiss_1_1IndexPreTransform.html#a02493fc85f4a47dce4ad7acd105320bf">faiss::IndexPreTransform</a>, <a class="el" href="structfaiss_1_1Index2Layer.html#af2e505c14e62234eb251fcb37ef012d2">faiss::Index2Layer</a>, <a class="el" href="structfaiss_1_1IndexIVF.html#a3b3270dcfa248dc30117644382a54e39">faiss::IndexIVF</a>, <a class="el" href="structfaiss_1_1MultiIndexQuantizer.html#aa5bd578560419955a4bf7035cf09a392">faiss::MultiIndexQuantizer</a>, <a class="el" href="structfaiss_1_1IndexScalarQuantizer.html#a8fb8680f64465d643d96119da58099f3">faiss::IndexScalarQuantizer</a>, <a class="el" href="structfaiss_1_1IndexHNSW.html#a660e5c8de1ba9c71bf3fe1f3bf0c8812">faiss::IndexHNSW</a>, <a class="el" href="classfaiss_1_1gpu_1_1GpuIndexFlat.html#a7f1cdf03d3545a43fc91bb5cace3b6fd">faiss::gpu::GpuIndexFlat</a>, <a class="el" href="structfaiss_1_1IndexIDMap2.html#a3660adb35a3299bc328988f5ff2199fe">faiss::IndexIDMap2</a>, <a class="el" href="structfaiss_1_1IndexPQ.html#a20913df3bfd8caa5187112641e8d9bc7">faiss::IndexPQ</a>, and <a class="el" href="structfaiss_1_1IndexFlat.html#ae4b33315752b62cff1626f9f967167b1">faiss::IndexFlat</a>.</p>

<p>Definition at line <a class="el" href="Index_8cpp_source.html#l00054">54</a> of file <a class="el" href="Index_8cpp_source.html">Index.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a1936604fffe16b0ef2a3879305950738"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void faiss::Index::reconstruct_n </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a>&#160;</td>
          <td class="paramname"><em>i0</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a>&#160;</td>
          <td class="paramname"><em>ni</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float *&#160;</td>
          <td class="paramname"><em>recons</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Reconstruct vectors i0 to i0 + ni - 1</p>
<p>this function may not be defined for some indexes </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">recons</td><td>reconstucted vector (size ni * d) </td></tr>
  </table>
  </dd>
</dl>

<p>Reimplemented in <a class="el" href="structfaiss_1_1IndexPreTransform.html#a370dd6ef091393401fa9b60e3d1d25b2">faiss::IndexPreTransform</a>, <a class="el" href="structfaiss_1_1Index2Layer.html#a226daedaa05c0e0bb3a0afb78d5aa120">faiss::Index2Layer</a>, <a class="el" href="structfaiss_1_1IndexIVF.html#a7cc286dfbd8bfd43ea4b22173e28231c">faiss::IndexIVF</a>, <a class="el" href="structfaiss_1_1IndexScalarQuantizer.html#a06e6935b75f0b209f65fffa1c9e1477c">faiss::IndexScalarQuantizer</a>, <a class="el" href="classfaiss_1_1gpu_1_1GpuIndexFlat.html#a472732e9bd8ffb1aa4c3abc31063dd28">faiss::gpu::GpuIndexFlat</a>, and <a class="el" href="structfaiss_1_1IndexPQ.html#a99b187b1231a700617f7b228ec348ade">faiss::IndexPQ</a>.</p>

<p>Definition at line <a class="el" href="Index_8cpp_source.html#l00059">59</a> of file <a class="el" href="Index_8cpp_source.html">Index.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="af8bf7bd97aeed8ad5fc48b242379a68a"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">long faiss::Index::remove_ids </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structfaiss_1_1IDSelector.html">IDSelector</a> &amp;&#160;</td>
          <td class="paramname"><em>sel</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>removes IDs from the index. Not supported by all indexes </p>

<p>Reimplemented in <a class="el" href="structfaiss_1_1IndexPreTransform.html#ad4e59f4dacc1d8183a788510680f0df5">faiss::IndexPreTransform</a>, <a class="el" href="structfaiss_1_1IndexIVF.html#a4e6f5ea9abc1a014531be989b5dea4b7">faiss::IndexIVF</a>, <a class="el" href="structfaiss_1_1IndexIVFPQR.html#acc5eeeeb8ac8d2581ef07947932d9f6c">faiss::IndexIVFPQR</a>, <a class="el" href="structfaiss_1_1IndexIVFFlatDedup.html#aae53833bb1e4041358cd4e5407d6a296">faiss::IndexIVFFlatDedup</a>, <a class="el" href="structfaiss_1_1IndexIDMap2.html#a87e313ebc8dd62fb734a61a6d95a98f0">faiss::IndexIDMap2</a>, <a class="el" href="structfaiss_1_1IndexFlat.html#a8d1ea1d28e80849f8b0f5493679d68c9">faiss::IndexFlat</a>, <a class="el" href="structfaiss_1_1IndexPQ.html#aa98b5481bf171d3ca6733e2d9e9ce4f6">faiss::IndexPQ</a>, and <a class="el" href="structfaiss_1_1IndexIDMap.html#a699ca4891bf3a437b2a182c04d33d9b9">faiss::IndexIDMap</a>.</p>

<p>Definition at line <a class="el" href="Index_8cpp_source.html#l00048">48</a> of file <a class="el" href="Index_8cpp_source.html">Index.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="aced51b1ebc33c47ab3ae15ea906559a7"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void faiss::Index::search </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a>&#160;</td>
          <td class="paramname"><em>n</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const float *&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a>&#160;</td>
          <td class="paramname"><em>k</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float *&#160;</td>
          <td class="paramname"><em>distances</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a> *&#160;</td>
          <td class="paramname"><em>labels</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>query n vectors of dimension d to the index.</p>
<p>return at most k vectors. If there are not enough results for a query, the result array is padded with -1s.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">x</td><td>input vectors to search, size n * d </td></tr>
    <tr><td class="paramname">labels</td><td>output labels of the NNs, size n*k </td></tr>
    <tr><td class="paramname">distances</td><td>output pairwise distances, size n*k </td></tr>
  </table>
  </dd>
</dl>

<p>Implemented in <a class="el" href="structfaiss_1_1IndexPreTransform.html#a7c2c820895d87083742969c281ae4911">faiss::IndexPreTransform</a>, <a class="el" href="structfaiss_1_1Index2Layer.html#a5961efc2e19d9a6e5224f477b6d1b226">faiss::Index2Layer</a>, <a class="el" href="structfaiss_1_1MultiIndexQuantizer2.html#adff25d40c18f5d7a65d359d1cd80ea29">faiss::MultiIndexQuantizer2</a>, <a class="el" href="structfaiss_1_1IndexHNSW2Level.html#a50a087a17ce5a7a1fbcca0836959b4ec">faiss::IndexHNSW2Level</a>, <a class="el" href="structfaiss_1_1IndexIVF.html#ae2fd47b7d52603659e269aa8f6abb613">faiss::IndexIVF</a>, <a class="el" href="structfaiss_1_1IndexFlat1D.html#a65736f2900865cd156faba4fcd260d05">faiss::IndexFlat1D</a>, <a class="el" href="structfaiss_1_1MultiIndexQuantizer.html#a999ee03f4e65f453377e209d10e25681">faiss::MultiIndexQuantizer</a>, <a class="el" href="structfaiss_1_1IndexRefineFlat.html#ad04444de1e2c26c463cc52f3c076dd41">faiss::IndexRefineFlat</a>, <a class="el" href="structfaiss_1_1IndexScalarQuantizer.html#abf24732c29106bb808148c3d30599662">faiss::IndexScalarQuantizer</a>, <a class="el" href="structfaiss_1_1IndexHNSW.html#ae0ddf6ab4a54239a25d6277e21e8548e">faiss::IndexHNSW</a>, <a class="el" href="structfaiss_1_1IndexSplitVectors.html#a4a010daf51e44d9717e94400cc23c159">faiss::IndexSplitVectors</a>, <a class="el" href="structfaiss_1_1IndexFlatL2BaseShift.html#a16e9bf1aec9d18b3ebbe78fea6bfecc0">faiss::IndexFlatL2BaseShift</a>, <a class="el" href="classfaiss_1_1gpu_1_1GpuIndex.html#a4564ff946e4339156173b39449562971">faiss::gpu::GpuIndex</a>, <a class="el" href="structfaiss_1_1IndexLSH.html#a66b6afb56afa1f58e2d93abfdfd223ee">faiss::IndexLSH</a>, <a class="el" href="structfaiss_1_1IndexPQ.html#a491ba3ed34093513e6a850fbca0abdd2">faiss::IndexPQ</a>, <a class="el" href="structfaiss_1_1IndexIDMap.html#a2f36fa9150a465b48952afbba856e2a1">faiss::IndexIDMap</a>, and <a class="el" href="structfaiss_1_1IndexFlat.html#a85510d70f4675197df9988651e4692c9">faiss::IndexFlat</a>.</p>

</div>
</div>
<a class="anchor" id="aa5b4e63e1064f9bf9c75625d114b353f"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void faiss::Index::search_and_reconstruct </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a>&#160;</td>
          <td class="paramname"><em>n</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const float *&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a>&#160;</td>
          <td class="paramname"><em>k</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float *&#160;</td>
          <td class="paramname"><em>distances</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a> *&#160;</td>
          <td class="paramname"><em>labels</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float *&#160;</td>
          <td class="paramname"><em>recons</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Similar to search, but also reconstructs the stored vectors (or an approximation in the case of lossy coding) for the search results.</p>
<p>If there are not enough results for a query, the resulting arrays is padded with -1s.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">recons</td><td>reconstructed vectors size (n, k, d) </td></tr>
  </table>
  </dd>
</dl>

<p>Reimplemented in <a class="el" href="structfaiss_1_1IndexPreTransform.html#a97ceaf3f87d3d729846762295351e972">faiss::IndexPreTransform</a>, and <a class="el" href="structfaiss_1_1IndexIVF.html#a77aec24920024a09f7661790d9534c10">faiss::IndexIVF</a>.</p>

<p>Definition at line <a class="el" href="Index_8cpp_source.html#l00066">66</a> of file <a class="el" href="Index_8cpp_source.html">Index.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="abf601502bdbfa02b9d7bcd7b3671b71d"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void faiss::Index::train </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">idx_t</a>&#160;</td>
          <td class="paramname"><em>n</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const float *&#160;</td>
          <td class="paramname"><em>x</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Perform training on a representative set of vectors</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">n</td><td>nb of training vectors </td></tr>
    <tr><td class="paramname">x</td><td>training vecors, size n * d </td></tr>
  </table>
  </dd>
</dl>

<p>Reimplemented in <a class="el" href="structfaiss_1_1IndexPreTransform.html#a416aaf28d7a533dcf7d2d7de434e993c">faiss::IndexPreTransform</a>, <a class="el" href="structfaiss_1_1Index2Layer.html#a48cbf519590313f1c6a3dc89c8d0678c">faiss::Index2Layer</a>, <a class="el" href="structfaiss_1_1MultiIndexQuantizer2.html#a553b9a33e9be7f231ffdc0ac53c59e7c">faiss::MultiIndexQuantizer2</a>, <a class="el" href="structfaiss_1_1IndexHNSWPQ.html#ae99b976eeb25717d10055b1786aa011c">faiss::IndexHNSWPQ</a>, <a class="el" href="structfaiss_1_1MultiIndexQuantizer.html#a6fa1d1a295eb2d4377b8de5096ab3ef4">faiss::MultiIndexQuantizer</a>, <a class="el" href="structfaiss_1_1IndexIVF.html#a7a1d5eec194db0977b2318c6ed6a2b86">faiss::IndexIVF</a>, <a class="el" href="structfaiss_1_1IndexRefineFlat.html#a79c4c9b9ffabc4460ef4def6eb962e68">faiss::IndexRefineFlat</a>, <a class="el" href="structfaiss_1_1IndexScalarQuantizer.html#a300647e9cdac9acd160f2c55c610056b">faiss::IndexScalarQuantizer</a>, <a class="el" href="structfaiss_1_1IndexSplitVectors.html#aafa4c780e325855fe247052453967845">faiss::IndexSplitVectors</a>, <a class="el" href="classfaiss_1_1gpu_1_1GpuIndexIVFPQ.html#ac4814acafa4bc340a4c4bdcafd469b56">faiss::gpu::GpuIndexIVFPQ</a>, <a class="el" href="structfaiss_1_1IndexHNSW.html#a40bc6d2c67545f95e322c63d68a47140">faiss::IndexHNSW</a>, <a class="el" href="classfaiss_1_1gpu_1_1GpuIndexFlat.html#a0e74fad76628ddfb5ae3dc1d1c69f7e8">faiss::gpu::GpuIndexFlat</a>, <a class="el" href="structfaiss_1_1IndexIVFFlatDedup.html#a24002a8c3f12aa2784833c14b13b427e">faiss::IndexIVFFlatDedup</a>, <a class="el" href="classfaiss_1_1gpu_1_1GpuIndexIVFFlat.html#a3c5b3760acb01814892fe93c72f08304">faiss::gpu::GpuIndexIVFFlat</a>, <a class="el" href="structfaiss_1_1IndexLSH.html#a01f569a16a812aa3945b8a0b64eaff06">faiss::IndexLSH</a>, <a class="el" href="structfaiss_1_1IndexPQ.html#a87898add5ab4d86ba901ca79778fc11e">faiss::IndexPQ</a>, and <a class="el" href="structfaiss_1_1IndexIDMap.html#ac873cb03aa323a06dca5d6f3af5fe559">faiss::IndexIDMap</a>.</p>

<p>Definition at line <a class="el" href="Index_8cpp_source.html#l00023">23</a> of file <a class="el" href="Index_8cpp_source.html">Index.cpp</a>.</p>

</div>
</div>
<hr/>The documentation for this struct was generated from the following files:<ul>
<li>/data/users/hoss/faiss/<a class="el" href="Index_8h_source.html">Index.h</a></li>
<li>/data/users/hoss/faiss/<a class="el" href="Index_8cpp_source.html">Index.cpp</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
</body>
</html>
